<?
class stock_price_LivePriceVo extends stock_price_PriceVo{
	public $market = 'market';
	public $volume0 = 'volume0';//"H";//
	
	public $ceil = 'ceil';//"I";//
	public $floor = 'floor';//"J";//
	public $ref = 'ref';//"K";//

	public $buyPrice3 = 'buyPrice3';//"L";//
	public $buyVolume3 = 'buyVolume3';//"M";//
	public $buyPrice2 = 'buyPrice2';//"N";//
	public $buyVolume2 = 'buyVolume2';//"O";//
	public $buyPrice1 = 'buyPrice1';//"P";//
	public $buyVolume1 = 'buyVolume1';//"Q";//

	public $sellPrice1 = 'sellPrice1';//"R";//
	public $sellVolume1 = 'sellVolume1';//"S";//
	public $sellPrice2 = 'sellPrice2';//"T";//
	public $sellVolume2 = 'sellVolume2';//"U";//
	public $sellPrice3 = 'sellPrice3';//"V";//
	public $sellVolume3 = 'sellVolume3';//"W";//
	
	public $buyVolumeP = 'buyVolumeP';//"Y";//
	public $sellVolumeP = 'sellVolumeP';//"Z";//
	
	public $average = 'average';//"X";//
	public $buyVolumeF = 'buyVolumeF';//"Y";//
	public $sellVolumeF = 'sellVolumeF';//"Z";//
	
	public function getLiveValue($dt){
		if($dt[$this->buyPrice1] != undefined) return 1.0*$dt[$this->volume]*$dt[$this->close] + $this->getLiveValueSub($dt);
		return 1.0*$dt[$this->volume]*$dt[$this->close];
	}
	
	public function getLiveValueSub($dt){
		return 1.0*$dt[$this->buyVolume1]*$dt[$this->buyPrice1] /*+ $dt[$this->buyVolume2]*$dt[$this->buyPrice2] + $dt[$this->buyVolume3]*$dt[$this->buyPrice3]*/
			 - 1.0*$dt[$this->sellVolume1]*$dt[$this->sellPrice1] /*- $dt[$this->sellVolume2]*$dt[$this->sellPrice2] - $dt[$this->sellVolume3]*$dt[$this->sellPrice3]*/;
	}
	
	public function getLiveVolume($dt){
		if($dt[$this->volume]==null) $dt[$this->volume] = 0;
		return 1.0*$dt[$this->volume] + $this->getLiveVolumeSub($dt);
	}
	
	public function getLiveVolumeSub($dt){
		if($dt[$this->buyVolume1] == undefined && $dt[$this->sellVolume1] == undefined) return 0.0;
		return 0.0 + 1.0*$dt[$this->buyVolume1] + 1.0*$dt[$this->sellVolume1];
	}
}